<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>The Concept of a Knob</title>
</head>

<body bgproperties="fixed">

<h1 align="center">Knobs in FPP</h1>

<p align="left">&nbsp;</p>

<p align="left">A real polymorph&nbsp; (<a href="../h_definition.htm#REAL_8">real_8</a>) 
can be three things:</p>
<ol>
  <li>

<p align="left">A Real number </li>
<li>

<p align="left">A <a href="../h_definition.htm#TAYLOR">Taylor</a> Series (an 
object from a TPSA package such as Berz's Package)</li>
<li>

<p align="left">A knob </li>
</ol>

<address><span style="font-style: normal">The knob is a simple Taylor series 
which cannot be changed by the code. For example, the following syntax is 
forbidden:</span></address>

<address><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Knob= a+b</span></address>

<address><span style="font-style: normal">Knobs are typically used for parameter 
dependence. For example, consider the following piece of code describing the 
standard map:</span></address>

<address>&nbsp;</address>

<address><span style="font-style: normal"><font color="#008080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  call alloc(x);call alloc(k);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k=0.1d0 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call make_it_knob(k,1)<b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="../init.htm" style="text-decoration: none">CALL </a></b></font>
<a href="../init.htm" style="text-decoration: none"><b>
<font face="Courier" color="#008080">INIT</font><font color="#008080">(</font><font face="Courier" color="#008080">NO1</font><font color="#008080">=1,ND1=1,NP1=1,</font><font face="Times New Roman" color="#008080">NDPT1 
=0</font></b><font color="#008080"><b>)&nbsp; </b></font></a></span></address>

<address><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
x(1)=1.d0.<a href="../mono.htm" style="text-decoration: none; font-weight: 700">mono</a>.1</span></address>

<address><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
x(2)=1.d0.<a href="../mono.htm" style="text-decoration: none; font-weight: 700">mono</a>.2</span></address>

<address><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
x(1)=x(1)+x(2)&nbsp; </span></address>

<address><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
x(2)=x(2)-k*sin(x(1))</span></address>

<address><span style="font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
call print(x(1),6);call print(x(2),6)</span></address>

<address>&nbsp;</address>

<address><span style="font-style: normal">The full code is found
  <a href="../simple_programs/z_knob.f90">here</a>.</span></address>

<address>&nbsp;</address>

<address><span style="font-style: normal">The output of this piece of code is:</span></address>

<blockquote>
  <blockquote>
    <blockquote>
      <blockquote>
        <blockquote>

<address align="left"><span style="font-style: normal">&nbsp;<font color="#800000">etall 
  1, NO = 2, NV = 3, INA = 14<br>
  *********************************************<br>
  <br>
  I COEFFICIENT ORDER EXPONENTS<br>
  NO = 2 NV = 3<br>
  1 1.000000000000000 1 0 0<br>
  1 1.000000000000000 0 1 0<br>
  -2 0.000000000000000 0 0 0<br>
  <br>
  etall 1, NO = 2, NV = 3, INA = 15<br>
  *********************************************<br>
  <br>
  I COEFFICIENT ORDER EXPONENTS<br>
  NO = 2 NV = 3<br>
  1 -0.1000000000000000 1 0 0<br>
  1 0.9000000000000000 0 1 0<br>
  2 -1.000000000000000 1 0 1<br>
  2 -1.000000000000000 0 1 1<br>
  -4 0.000000000000000 0 0 0</font></span></address>

<address align="left">&nbsp;</address>

<address align="left">&nbsp;</address>

        </blockquote>
      </blockquote>
    </blockquote>
  </blockquote>
</blockquote>
<p>The polymorph <b>k </b>is set to the following value by the subroutine
<a href="../m_real_polymorph.htm#MAKE_IT_KNOB" style="text-decoration: none; font-weight: 700">
make_it_knob</a>:</p>
<p>k=&gt;&nbsp; 0.1d0 + x<sub>nd2+1 </sub>by the call
<a href="../m_real_polymorph.htm#MAKE_IT_KNOB" style="text-decoration: none; font-weight: 700">
make_it_knob(k,1)</a></p>
<p>&nbsp;</p>
<p>The routine
<a href="../m_real_polymorph.htm#MAKE_IT_KNOB" style="text-decoration: none; font-weight: 700">
make_it_knob</a>(k,i,s) has the optional parameter &quot;s&quot;:</p>
<p>k=&gt;&nbsp; k<sub>0</sub> + s x<sub><a href="../h_definition.htm" style="text-decoration: none; font-weight: 700">npara_fpp</a>+i&nbsp;
</sub><br>
<br>
FPP has several global parameters related to knobs:</p>
<p>
<a href="../h_definition.htm" style="text-decoration: none; font-weight: 700">
npara_fpp</a> which locates where the knobs start. For example, in the above
<span style="font-style: normal">
<a href="../init.htm" style="text-decoration: none"><b>
<font face="Courier" color="#008080">INIT</font></b></a><font color="#008080"><a href="../init.htm">,</a>
</font>the default value for </span>
<a href="../h_definition.htm" style="text-decoration: none; font-weight: 700">
npara_fpp</a> is always 2*ND1. In a call of INIT without maps, the default 0.&nbsp;
<a href="../h_definition.htm" style="text-decoration: none; font-weight: 700">
npara_fpp</a> call always be overwritten by a user. (<font color="#800000"><b>N.B.</b></font> In the code 
PTC,
<a href="../h_definition.htm" style="text-decoration: none; font-weight: 700">
npara_fpp</a> is reset when the the variable de/p0c is not a canonical variable. 
In that case,
<a href="../h_definition.htm" style="text-decoration: none; font-weight: 700">
npara_fpp</a><a href="../h_definition.htm" style="text-decoration: none; "> </a>
<a href="../h_definition.htm">
i</a>s set to 5 in PTC.&nbsp; )</p>

<p>
<u><b>Ignoring Knobs</b></u></p>

<p>
When knobs have been set, it is possible to ignore them during a calculation. In 
that case, they reverse to real temporarily. This is controled by the parameter 
c_%knob which is set to false. Normally c_%knob is true in FPP. (<font color="#800000"><b>N.B.
</b></font>In PTC, c_%knob is set to false by default).</p>

<p>
<u><b>Killing Knobs</b></u></p>

<p>
Knobs must be killed, i.e., turned into kind=1 (real) when a calculation is 
finished. Failure to do this could lead to erroneous results within a single run 
where different sets of&nbsp; knobs are used successively. This is done with the 
command:</p>

<p>
<b><a href="../m_real_polymorph.htm#KILL_KNOB" style="text-decoration: none">
call kill_knob(k)</a></b></p>

<p>
&nbsp;</p>

<p>
&nbsp;</p>

<p>
&nbsp;</p>

</body>

</html>